package org.ruanjj.multithread.JUC;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.FutureTask;

public class CountDownLatchDemo {
    public static void main(String[] args) {
        CountDownLatch a = new CountDownLatch(6);

        for(int i = 0 ; i < 6; i++){
            new Thread(()->{
                System.out.println(Thread.currentThread().getName()+"号离开了教室");
                a.countDown();
            },String.valueOf(i)).start();
        }

        try {
            a.await();
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }

        System.out.println(Thread.currentThread().getName()+"班长锁门走人了");
    }

}
